package com.budwk.app.sqfw.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 安全隐患状态a13
 */
@Getter
public enum SafeHazardA13Enum {

    ALL(1, "全部"),
    NO(2, "无"),
    YES(3, "有"),
    COMPLETE(5, "整改完成");

    private Integer code;

    private String name;

    SafeHazardA13Enum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * @param code
     * @return
     */
    public static String getName(Integer code) {
        for (SafeHazardA13Enum o : SafeHazardA13Enum.values()) {
            if (o.getCode() == code) {
                return o.getName();
            }
        }
        return null;
    }

    public static List<String> listNams() {
        return Arrays.stream(SafeHazardA13Enum.values()).map(SafeHazardA13Enum::getName).collect(Collectors.toList());
    }
}
